package com.wz.token.config;

import com.wz.token.TokenProperties;
import com.wz.token.interceptor.TokenInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

public class TokenInterceptorConfig implements WebMvcConfigurer {

    TokenInterceptor tokeninterceptor;

    TokenProperties properties;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(tokeninterceptor)
                .addPathPatterns(properties.getPathPatterns())
                .excludePathPatterns(properties.getExcludePathPatterns());
    }

    public TokenInterceptor getTokenInterceptor() {
        return tokeninterceptor;
    }

    public void setTokenInterceptor(TokenInterceptor tokeninterceptor) {
        this.tokeninterceptor = tokeninterceptor;
    }

    public TokenProperties getProperties() {
        return properties;
    }

    public void setProperties(TokenProperties properties) {
        this.properties = properties;
    }
}